package s15;

import base.Bean2;
import net.sf.cglib.reflect.MethodDelegate;

/**
 * @author wangpp
 */
public class MethodDelegateTest {


    public interface MainDelegate {
        int main(String[] args);
    }

    public int alternateMain(String[] args) {
        for (int i = 0; i < args.length; i++) {
            System.out.println(args[i]);
        }
        return args.length;
    }

    public static void main(String[] args) {
        MethodDelegateTest test = new MethodDelegateTest();

        MainDelegate start = (MainDelegate) MethodDelegate.create(test, "alternateMain", MainDelegate.class);
        start.main(new String[]{"1", "2"});

    }
}
